﻿@{
	ViewBag.Title = T("Manage forums");
}
<div class="row-fluid">

@Html.Partial("AdminMenu", ViewData)
        <div class="span10">
        <ul class="breadcrumb">
	<li>@Html.ActionLinkLocalized("Forums", "List", "Forums")<span class="divider">/</span></li>
	<li>@Html.ActionLinkLocalized("Admin", "Dashboard", "Admin")</li>
</ul>
        <div class="page-header">
    <h1>@ViewBag.Title<small>@T("Add / edit / delete forums.")</small></h1></div>
    @{Html.BeginForm(null, null, FormMethod.Post, new{@id="manageForm"});}
    @Html.AntiForgeryToken()
    <input type="hidden" name="forum" id="shortName" value="" />
    <ul class="unstyled">
	@foreach (ForumCategory category in this.Model)
	{
		foreach (Forum f in category.Forums)
		{
			<li><button class="btn" href="#">
					@Html.ActionLinkLocalized("Edit", "Edit", "Forums", new { forum = f.ShortName, style = "color:White;" }, null)</button>
					<button  class="btn" href="" onclick="return deleteForum('@(f.ShortName)');"><a>@T("Delete")</a></button>				
				 <button class="btn" href="#">@Html.ActionLink(@category.Name + " > " + f.Name, "Detail", "Forums", new{forum=f.ShortName}, null)</button>
			</li>
		}	
	}
	</ul>
	@{Html.EndForm();}
	<p class="action">@Html.ActionLinkLocalized("Create a new forum >>", "Add", "Forums", new { @class = "btn btn-primary" })</p>
</div>
    </div>
	<script type="text/javascript">
		function deleteForum(name)
		{
			if (confirm('@T("Are you sure you want to delete this forum?.\\nAll threads and posts of this forum will not be accessible.")'))
			{
				$("#shortName").val(name);
				$('#manageForm').attr('action', '@(Url.Action("Delete", "Forums"))').submit();
			}
			return false;
		}
	</script>